package com.cp.openfeign;

import com.cp.commons.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;

/**
 * @author feipeng
 * @site www.gcp168.cn
 * @create 2020-08-25 22:23
 */
@RestController
public class HelloController {
    @Autowired
    HelloService helloService;

    @GetMapping("/hello")
    public String hello() throws UnsupportedEncodingException {
        String s = helloService.hello2("飞鹏");
        System.out.println(s);
        User user = new User();
        user.setId(1);
        user.setUsername("cp");
        user.setPassword("123");
        User u = helloService.addUser2(user);
        System.out.println(u);
        helloService.deleteUser2(1);
        helloService.getUserByName(URLEncoder.encode("飞鹏","UTF-8"));
        return helloService.hello();
    }
}
